#include <semaphore.h>

#ifndef BUFFER_DEFINING
#define BUFFER_DEFINING


enum Commands {BALANCE, DEPOSIT, WITHDRAW, CREATE, CLOSE};

enum Commands get_command(char  c[]);

struct request_struct {
  int account;
  float amount;
  enum Commands command;
  sem_t event;
  char message [80];
  int return_code;
};

typedef struct request_struct request;

struct buffer_struct {
  sem_t empty;
  sem_t full;
  sem_t lock;
  request requests [10];
  int current_request;
};

typedef struct buffer_struct buffer;

buffer make_buf();

request read_request(int account, float amount, enum Commands command);

#endif
